home *** CD-ROM | disk | FTP | other *** search
/ Almathera Ten Pack 3: CDPD 3 / Almathera Ten on Ten - Disc 3: CDPD3.iso / fish / 726-750 / 740 / debt / debt.s < prev    next >
Text File  |  1995-03-18  |  31KB  |  1,450 lines

  1.  
  2.     XREF    _AbsExecBase
  3.     XREF    _LVOOpenLibrary
  4.     XREF    _LVOCloseLibrary
  5.     XREF    _LVOWait
  6.     XREF    _LVOOpenWindow
  7.     XREF    _LVOCloseWindow
  8.     XREF    _LVOGetMsg
  9.     XREF    _LVOReplyMsg
  10.     XREF    _LVOMove
  11.     XREF    _LVOText
  12.     XREF    _LVOSetAPen
  13.     XREF    _LVORectFill
  14.     XREF    _LVOWaitPort
  15.     XREF    _LVOForbid
  16.     XREF    _LVOPermit
  17.     XREF    _LVOScrollRaster
  18.     XREF    _LVOWaitTOF
  19.  
  20. GADGETUP    EQU    $00000040
  21. CLOSEWINDOW    EQU    $00000200
  22. WINDOWCLOSE    EQU    $0008
  23. SMART_REFRESH    EQU    $0000
  24. ACTIVATE    EQU    $1000
  25. WINDOWDRAG    EQU    $0002
  26. WBENCHSCREEN    EQU    $0001
  27. GADGHCOMP    EQU    $0000
  28. RELVERIFY    EQU    $0001
  29. BOOLGADGET    EQU    $0001
  30. WINDOWDEPTH    EQU    $0004
  31. ThisTask    EQU    $0114
  32. pr_CLI        EQU    $00ac
  33. pr_MsgPort    EQU    $005c
  34.  
  35.     CODE  CODE
  36.           public _Debt
  37. _Debt:
  38.     move.l    a7,parksp
  39.     move.l    #0,WBenchMsg
  40.     movea.l    _AbsExecBase,a6     ;test if WB or CLI
  41.     movea.l    ThisTask(a6),a4
  42.     tst.l    pr_CLI(a4)
  43.     bne.s    fromCLI
  44.  
  45.     lea     pr_MsgPort(a4),a0       ;get WB Message
  46.     jsr     _LVOWaitPort(a6)
  47.     lea     pr_MsgPort(a4),a0       ;maybe refreshing a0 will prevent
  48.     jsr     _LVOGetMsg(a6)          ;the crashes I get on WB.
  49.     move.l    d0,WBenchMsg
  50. fromCLI:
  51.     movea.l    #IntuitionName,a1
  52.     moveq    #33,d0
  53.     movea.l    _AbsExecBase,a6
  54.     jsr     _LVOOpenLibrary(a6)
  55.     move.l    d0,IntBase
  56.     beq     Abort
  57.     movea.l    #GName,a1
  58.     moveq    #33,d0
  59.     jsr     _LVOOpenLibrary(a6)
  60.     move.l    d0,GBase
  61.     beq     Abort2
  62.     movea.l    #NewWdw,a0
  63.     movea.l    IntBase,a6
  64.     jsr     _LVOOpenWindow(a6)
  65.     move.l    d0,Wdw
  66.     beq     Abort3
  67.  
  68.     movea.l    Wdw,a0
  69.     move.l    50(a0),rp               ;save rasterport address
  70.     move.l    86(a0),a0               ;save userport address
  71.     move.l    a0,userport
  72.     move.b    15(a0),d1               ;byte mp_sigbit
  73.     moveq.l    #1,d0            ;Make a mask and save it.
  74.     lsl.l    d1,d0
  75.     move.l    d0,sigmask
  76.  
  77. ;**********************************
  78.  
  79. startover:
  80.     bsr     ClearAll
  81.     bsr     BuildAString
  82.     cmp     #CLOSEWINDOW,d5
  83.     beq     closeup
  84.     cmp     #14,d5
  85.     beq     startover
  86.     lea     accum1+63,a4        ;set up for pack
  87.     bsr     pack
  88.     bsr     ClearInBuf
  89. secondpass:
  90.     move    dec,firstdec        ;switch signs and negs around for
  91.     move.b    negative,firstneg    ;second pass.
  92.     move.b    #0,point        ;clear period inhibitor.
  93.     move    #0,dec
  94.     move.b    #0,negative
  95.     move.b    #0,havept
  96.     addi    #9,printy
  97.     bsr     BuildAString
  98.     cmp     #CLOSEWINDOW,d5
  99.     beq     closeup
  100.     cmp     #14,d5
  101.     beq     startover
  102.  
  103.     lea     accum2+63,a4
  104.     bsr     pack
  105.     cmp.b    #43,fun
  106.     beq.s    t1
  107.     cmp.b    #45,fun
  108.     bne.s    t2
  109. t1:
  110.     bsr     WhatTheHell
  111. t2:
  112.     cmp.b    #42,fun
  113.     bne.s    t3
  114.     bsr     multiply
  115. t3:
  116.     cmp.b    #47,fun
  117.     bne.s    t4
  118.     bsr     divide
  119. t4:
  120.     move.b    #0,havept
  121.     bsr     unpack
  122.     addi    #9,printy
  123.     cmp.b    #47,fun
  124.     beq.s    t5
  125.     move    chars,d0        ;check for overflow
  126.     sub     res_pts,d0
  127.     cmpi    #$78,d0
  128.     bhi     error
  129. t5:
  130.     lea     buildstr,a0
  131.     bsr     print_bs
  132. t6:
  133.     move.b    fun2,fun
  134.     cmp.b    #61,fun2
  135.     bne     chain2
  136.     bsr     waitforkey
  137.     cmp     #CLOSEWINDOW,d5
  138.     beq     closeup
  139.  
  140.     cmp     #45,d5            ; -
  141.     beq.s    chain
  142.     cmp     #43,d5            ; +
  143.     beq.s    chain
  144.     cmp     #47,d5            ; /
  145.     beq.s    chain
  146.     cmp     #42,d5            ; *
  147.     beq.s    chain
  148.     bra     startover
  149. chain:
  150.     move.b    d5,fun
  151. chain2:
  152.     bsr     ClearInBuf
  153.     movea.l    GBase,a6
  154.     move.b    eq,d6
  155.     ext     d6
  156. scroll:
  157.     movea.l    rp,a1
  158.     move    #0,d0
  159.     move    #1,d1
  160.     move    #5,d2
  161.     move    #11,d3
  162.     move    #485,d4
  163.     move    #72,d5
  164.     jsr     _LVOScrollRaster(a6)
  165.     jsr     _LVOWaitTOF(a6)
  166.     jsr     _LVOWaitTOF(a6)
  167.     dbra    d6,scroll        ;just to slow it down
  168.  
  169.     move.b    eq,d0            ;eq contains scroll y + 1
  170.     ext     d0
  171.     sub     d0,printy
  172.     addi    #8,printy
  173.     move    res_pts,dec
  174.     move.b    res_sign,negative
  175.     move.b    #0,res_sign
  176.  
  177.     lea     fun,a0
  178.     move    #1,chars
  179.     bsr     print_bs
  180.  
  181.     lea     accum2,a2
  182.     lea     accum1,a1
  183.     bsr     exchange        ;put prev answer in accum1
  184.     lea     accum2,a2
  185.     lea     accum3,a3
  186.     move.l    #0,d1
  187.     move    #15,d2
  188. clear1:
  189.     move.l    d1,(a2)+
  190.     move.l    d1,(a3)+
  191.     dbra    d2,clear1
  192.     bra     secondpass
  193.  
  194. ;*********************************
  195. closeup:
  196.     movea.l    Wdw,a0
  197.     movea.l    IntBase,a6
  198.     jsr     _LVOCloseWindow(a6)
  199. Abort3:
  200.     movea.l    GBase,a1
  201.     movea.l    _AbsExecBase,a6
  202.     jsr     _LVOCloseLibrary(a6)
  203. Abort2:
  204.     movea.l    IntBase,a1
  205.     movea.l    _AbsExecBase,a6
  206.     jsr     _LVOCloseLibrary(a6)
  207. Abort:
  208.     movea.l    parksp,a7
  209.     tst.l    WBenchMsg
  210.     beq.s    CLIclose
  211.     movea.l    _AbsExecBase,a6
  212.     jsr     _LVOForbid(a6)       reply to WB
  213.     lea     WBenchMsg,a1
  214.     jsr     _LVOReplyMsg(a6)
  215.     jsr     _LVOPermit(a6)
  216. CLIclose:
  217.     move.l    #0,d0
  218.     rts
  219.  
  220. ;*********************************************************************
  221. ;             PRINT ERROR STRING
  222. ;*********************************************************************
  223.  
  224. error:
  225.     lea     errstr,a0
  226.     movea.l    rp,a1
  227.     moveq    #5,d0
  228.     move    printy,d1
  229.     movea.l    GBase,a6
  230.     jsr     _LVOMove(a6)
  231.     move    #5,d0
  232.     jsr     _LVOText(a6)
  233.     bsr     waitforkey
  234.     bra     startover
  235.  
  236. ;************************************************************************
  237. ;               SUBROUTINE CLEAR ALL
  238. ;               uses a1,a2,a3,a4,a6, d0,d1
  239. *************************************************************************
  240.  
  241. ClearAll:
  242.     lea     buildstr,a1
  243.     lea     accum1,a2
  244.     lea     accum2,a3
  245.     lea     accum3,a4
  246.     lea     buildstr+64,a6
  247.     moveq.l    #0,d0
  248.     moveq    #15,d1
  249. clearly:
  250.     move.l    d0,(a1)+
  251.     move.l    d0,(a2)+
  252.     move.l    d0,(a3)+
  253.     move.l    d0,(a4)+
  254.     move.l    d0,(a6)+
  255.     dbra    d1,clearly
  256.     lea     printy,a1
  257.     move.l    d0,(a1)+                ;need 17 more bytes cleared
  258.     move.l    d0,(a1)+
  259.     move.l    d0,(a1)+
  260.     move.l    d0,(a1)+
  261.     move.l    d0,(a1)+
  262.     move.l    d0,(a1)+                ;24 now
  263. clearscn:
  264.     movea.l    rp,a1
  265.     movea.l    GBase,a6
  266.     moveq.b    #0,d0
  267.     jsr     _LVOSetAPen(a6)
  268.     moveq    #4,d0
  269.     moveq    #10,d1
  270.     move    #485,d2
  271.     moveq    #72,d3
  272.     jsr     _LVORectFill(a6)
  273.     moveq.b    #1,d0
  274.     movea.l    rp,a1            ;a1 trashed by RectFill
  275.     jsr     _LVOSetAPen(a6)         ;put rp back into a1
  276.     move    #17,printy
  277.     rts
  278.  
  279. ;************************************************************************
  280. ;           SUBROUTINE JUST CLEAR INPUT BUFFER
  281. ;
  282. *************************************************************************
  283.  
  284. ClearInBuf:
  285.     lea     buildstr,a1
  286.     move.l    #0,d0
  287.     moveq    #15,d1
  288. bufcl:
  289.     move.l    d0,(a1)+
  290.     dbra    d1,bufcl
  291.     rts
  292.  
  293. ;************************************************************************
  294. ;             SUBROUTINE WAIT FOR KEY
  295. ;             uses a0,a1,a6, d0,d1,d5
  296. ;************************************************************************
  297.  
  298. waitforkey:
  299.     movea.l    _AbsExecBase,a6
  300.     move.l    sigmask,d0
  301.     jsr     _LVOWait(a6)
  302. WFK1:
  303.     movea.l    userport,a0
  304.     jsr     _LVOGetMsg(a6)
  305.     tst.l    d0
  306.     beq.s    return
  307.     move.l    d0,a1
  308.     move.l    20(a1),class            ;msg->Class is 20
  309.     move.l    28(a1),a0               ;msg->IAddress 28
  310.     move    38(a0),d5               ;IAddress->GadgetID is 38
  311.     jsr     _LVOReplyMsg(a6)
  312.     move.l    class,d0
  313.     cmp.l    #CLOSEWINDOW,d0
  314.     bne.s    WFK1
  315.     move    d0,d5
  316.     bra     WFK1
  317. return:
  318.     rts
  319.  
  320. ;************************************************************************
  321. ;             SUBROUTINE BUILD A STRING
  322. ;                  uses a5,    d4,d5
  323. ;************************************************************************
  324.  
  325. BuildAString:
  326.     moveq.l    #0,d4
  327.     lea     buildstr,a5
  328.  
  329.     cmp     #57,d5
  330.     bhi     again
  331.     cmp     #47,d5
  332.     bhi     dont
  333. again:
  334.     bsr     waitforkey
  335.     cmp     #CLOSEWINDOW,d5
  336.     bne.s    dont
  337.     rts
  338. dont:
  339.     cmp     #13,d5            ; C
  340.     bne     checkbs
  341.     bsr     ClearInBuf
  342.     lea     blanks,a0
  343.     bsr     print_bs
  344.     move.b    #0,point
  345.     move.b    #0,negative
  346.     bra     BuildAString
  347. checkbs:
  348.     cmp     #19,d5            ; <
  349.     bne.s    not_bs            ;does not count. only allows 1 point.
  350.     tst.b    point
  351.     beq.s    nopoint
  352.     move.b    #0,point
  353. nopoint:
  354.     subq    #1,d4
  355.     move    #32,d5
  356.     bra     ok
  357. not_bs:
  358.     cmp     #14,d5            ; AC
  359.     bne.s    not_AC
  360.     rts                 ;with a 14 in d5
  361. not_AC:
  362.     cmp     #61,d5            ; =
  363.     beq     equals
  364.     cmp     #46,d5            ; .
  365.     beq     period
  366.     cmp     #45,d5            ; -
  367.     beq.s    minus
  368.     cmp     #43,d5            ; +
  369.     beq.s    plus
  370.     cmp     #47,d5            ; /
  371.     beq.s    funct
  372.     cmp     #42,d5            ; *
  373.     beq.s    funct
  374. ok:
  375.     cmp     #59,d4
  376.     bhi     again
  377.     move.b    d5,0(a5,d4)             ;a5 buildstr
  378.     addq    #1,d4
  379.     move    d4,chars
  380.     movea.l    a5,a0
  381.     bsr     print_bs        ;print length d4 from buildstr array.
  382.     cmp.b    #32,d5            ;if d5==32 it is a backspace
  383.     bne     again            ;if d4==0 you are at left margin
  384.     cmp     #0,d4            ;if bksp and ! at margin subtract 1
  385.     beq     again
  386.     subq    #1,d4
  387.     bra     again
  388. minus:
  389.     tst     d4
  390.     bne     funct
  391.     move.b    #1,negative
  392.     bra     ok
  393. plus:
  394.     tst     d4
  395.     bne     funct
  396.     move.b    #0,negative
  397.     bra     ok
  398. funct:
  399.     cmp     #1,d4
  400.     bhi.s    allisright        ;Almost. Still lets -. to go through.
  401.     cmp.b    #48,(a5)                ;Supposed to stop crashing when no
  402.     bcs     again            ;number, only function, is entered.
  403. allisright:                ;Still crashes on -.* combination.
  404.     tst.b    fun
  405.     bne.s    alright
  406.     addi    #9,printy
  407. already:
  408.     move.b    d5,fun
  409.     lea     fun,a0
  410.     move    #1,chars
  411.     bsr     print_bs
  412.     rts
  413. period:
  414.     tst.b    point            ;does not count.  only allows 1 pt.
  415.     bne     again
  416.     move.b    #1,point
  417.     bra     ok
  418. equals:
  419.     cmp     #1,d4
  420.     bhi.s    alright
  421.     cmp.b    #48,(a5)
  422.     bcs     again
  423. alright:
  424.     move.b    d5,fun2
  425.     move.b    #61,eq
  426.     lea     eq,a0
  427.     addi    #9,printy
  428.     move    #1,chars
  429.     bsr     print_bs
  430.     move    printy,d5
  431.     subi    #9,d5
  432.     move.b    d5,eq            ;number of lines to scroll
  433.     rts
  434.  
  435. ;************************************************************************
  436. ;            SUBROUTINE TO ALIGN DECIMAL POINTS
  437. ;                  uses d1,d2, a4
  438. ;************************************************************************
  439.  
  440. align:
  441.     move    firstdec,d1        ;if firstdec>dec then shift2 left
  442.                     ;if dec>firstdec then shift1 left
  443.     move    dec,d2
  444.     cmp     d2,d1
  445.     bhi.s    shift2            ;three-way branch 1, 2, or rts
  446.     bcs.s    shift1
  447.     move    d2,res_pts
  448.     rts
  449. shift1:
  450.     move    d2,res_pts        ;no of dec points in answer
  451.     sub     d1,d2
  452.     subq    #1,d2
  453. line1:
  454.     lea     accum1+63,a4        ;call shift with accum addr+63 in a4
  455.     bsr     shift_l
  456.     dbra    d2,line1
  457.     rts
  458. shift2:
  459.     move    d1,res_pts
  460.     sub     d2,d1
  461.     subq    #1,d1
  462. line2:
  463.     lea     accum2+63,a4
  464.     bsr     shift_l
  465.     dbra    d1,line2
  466.     rts
  467.  
  468. ;************************************************************************
  469. ;         SUBROUTINE TO ADD TWO BCD NUMBERS OF LENGTH  120
  470. ;              uses a0,a1,  d1
  471. ;************************************************************************
  472.  
  473. addemup:
  474.     moveq    #65,d1            ;31 one for final carry
  475.     lea     accum1+65,a0
  476.     lea     accum2+65,a1
  477.     move.b    #4,ccr            ;x=0 and z=1
  478. keepadding:
  479.     abcd    -(a0),-(a1)
  480.     dbra    d1,keepadding
  481.     rts
  482.  
  483. ;************************************************************************
  484. ;       SUBROUTINE TO SUBTRACT TWO BCD NUMBERS OF LENGTH 120
  485. ;             uses a0,a1,  d1
  486. ;************************************************************************
  487.  
  488. subem:
  489.     moveq    #65,d1            ;31 one for final carry
  490.     lea     accum1+65,a0
  491.     lea     accum2+65,a1
  492.     move.b    #4,ccr            ;x=0 and z=1
  493. keepsubbing:
  494.     sbcd    -(a0),-(a1)
  495.     dbra    d1,keepsubbing
  496.     rts
  497.  
  498. ;************************************************************************
  499. ;    SUBROUTINE TO MULTIPLY TWO NUMBERS OF COMBINED LENGTH 120
  500. ;         uses d0,d1,d2,  a0,a1,a2,a4 for calling shift_l
  501. ;************************************************************************
  502.  
  503. multiply:
  504.     lea     accum2,a2
  505.     lea     accum3,a1
  506.     bsr     exchange        ;so answer will end up in accum2
  507. retry:
  508.     lea     accum1,a1
  509.     move    #64,d2
  510. M0:
  511.     tst.b    (a1)+
  512.     dbne    d2,M0
  513.     cmp.b    #-1,d2
  514.     bne.s    Mzero
  515.     rts
  516. Mzero:
  517.     lsl     #1,d2
  518.     subq    #1,a1
  519.     cmp.b    #9,(a1)
  520.     bhi.s    even_one
  521.     subq    #1,d2
  522. even_one                ;d2 has len accum1
  523.     move.b    d2,div1
  524.  
  525.     lea     accum3,a1
  526.     move    #64,d0
  527. M1:
  528.     tst.b    (a1)+
  529.     dbne    d0,M1
  530.     cmp     #-1,d0
  531.     bne.s    M2
  532.     rts
  533. M2:                    ;d0 has length of accum3.
  534.     lsl     #1,d0
  535.     subq    #1,a1
  536.     cmp.b    #9,(a1)
  537.     bhi.s    even_two
  538.     subq    #1,d0
  539. even_two
  540.     move.b    d0,div2
  541.  
  542.     add     d0,d2
  543.     cmp     #121,d2
  544.     bcs.s    not_too_big
  545.     tst     firstdec
  546.     beq     error
  547.     sub     #1,firstdec
  548.     lea     accum1,a4
  549.     bsr     shift_r
  550.     bra     retry
  551. not_too_big:
  552.     btst    #0,d0
  553.     beq.s    notset            ;if set, we did a sub on an even number
  554.     addq    #1,d0            ;4 lines backaways
  555. notset
  556.     lsr     #1,d0
  557.     subq    #1,d0            ;to adjust for decrement and branch
  558. M3:
  559.     move.b    (a1),d2                 ;d2 contains first or odd lh digit
  560.     swap    d2
  561.     move.b    (a1)+,d2                ;after swap, second or even lh digit
  562.     lsr     #4,d2
  563.     andi    #$000f,d2
  564.     subq    #1,d2
  565.     bmi.s    nogo
  566.     lea     accum2+63,a4
  567.     bsr     shift_l
  568. goagain:
  569.     lea     accum1+64,a0
  570.     lea     accum2+64,a2
  571.     moveq    #61,d1
  572.     move.b    #4,ccr            ;x=0 and z=1
  573. keepitup:
  574.     abcd    -(a0),-(a2)
  575.     dbra    d1,keepitup
  576.     dbra    d2,goagain
  577.     bra     secondhalf
  578. nogo:
  579.     lea     accum2+63,a4
  580.     bsr     shift_l
  581. secondhalf:
  582.     swap    d2
  583.     andi    #$000f,d2
  584.     subq    #1,d2
  585.     bmi.s    nogo2
  586.     lea     accum2+63,a4
  587.     bsr     shift_l
  588. gogo:
  589.     lea     accum1+64,a0
  590.     lea     accum2+64,a2
  591.     moveq    #61,d1
  592.     move.b    #4,ccr            ;x=0 and z=1
  593. keep_on:
  594.     abcd    -(a0),-(a2)
  595.     dbra    d1,keep_on
  596.     dbra    d2,gogo
  597.     bra     decrement
  598. nogo2:
  599.     lea     accum2+63,a4
  600.     bsr     shift_l
  601. decrement:
  602.     dbra    d0,M3
  603.     move    dec,d1
  604.     move    firstdec,d2
  605.     add     d1,d2
  606.     move    d2,res_pts
  607.     move.b    firstneg,d2
  608.     cmp.b    negative,d2
  609.     beq.s    exit
  610.     move.b    #1,res_sign
  611. exit:
  612.     rts
  613.  
  614. ;************************************************************************
  615. ;           SUBROUTINE TO DIVIDE TWO NUMBERS OF LENGTH 120
  616. ;     uses a0,a1,a2,a3,  d0,d1,d2      shift_l uses d4,d5,d6,   a4,a5
  617. ;************************************************************************
  618.  
  619. divide:
  620.     lea     accum2+63,a3        ;later move this to top of function
  621.     lea     accum3,a1
  622.     lea     accum2,a2
  623.     bsr     exchange
  624.     lea     accum1,a0
  625.     lea     accum1+63,a4
  626.     move    #$80,d0
  627. align_1_l:
  628.     bsr     shift_l
  629.     cmp.b    #1,(a0)
  630.     dbhi    d0,align_1_l
  631.     bmi     error
  632.     move.b    d0,div1
  633.     lea     accum3+63,a4
  634.     lea     accum3,a0
  635.     move    #$80,d0
  636. align_3_l:
  637.     bsr     shift_l
  638.     cmp.b    #1,(a0)
  639.     dbhi    d0,align_3_l
  640.     bmi     error
  641.     move.b    d0,div2
  642.     moveq    #120,d2
  643.     lea     accum2,a4
  644. Dzero:                    ; don't ever use labels D1, D2, etc.
  645.     moveq    #-1,d0            ; It won't cry error but crash.
  646. do_it_again:
  647.     addq    #1,d0
  648.     lea     accum1+64,a0
  649.     lea     accum3+64,a2
  650.     moveq    #63,d1
  651.     move.b    #4,ccr            ;x=0 and z=1
  652. redo:
  653.     sbcd    -(a2),-(a0)
  654.     dbra    d1,redo
  655.     bcc     do_it_again
  656.     and     #$f,d0
  657.     or.b    d0,(a3)
  658.     lea     accum2+63,a4
  659.     bsr     shift_l
  660.     lea     accum1+64,a0        ;after carry sets add one back
  661.     lea     accum3+64,a2
  662.     moveq    #63,d1
  663.     move.b    #4,ccr
  664. Dthree:
  665.     abcd    -(a2),-(a0)
  666.     dbra    d1,Dthree
  667.     lea     accum3,a4
  668.     bsr     shift_r
  669.     dbra    d2,Dzero
  670.     move    #121,res_pts
  671. ;**************figure out points
  672.     move.b    div1,d1        ;div1 and div2 contain number of places in
  673.     move.b    div2,d2        ;operators.
  674.     ext     d1           ;
  675.     ext     d2           ;
  676.     cmp     d1,d2           ;
  677.     bhi.s    toohigh        ;if div2>div1 then move point to right
  678.     sub     d2,d1           ;by subtracting difference from res_pts
  679.     sub     d1,res_pts     ;
  680.     bra     CkDec           ;
  681. toohigh:               ;
  682.     sub     d1,d2           ;if div1>div2 do the opposite.  Add to res_pts
  683.     add     d2,res_pts     ;to move point to left
  684. CkDec:                   ;
  685.     move    firstdec,d1    ;if dec>firstdec then move point to right
  686.     move    dec,d2           ;
  687.     cmp     d1,d2           ;
  688.     bhi.s    tohigh           ;
  689.     sub     d2,d1           ;if firstdec>dec move point to left
  690.     add     d1,res_pts     ;
  691.     bra     CkSgn           ;
  692. tohigh:                ;
  693.     sub     d1,d2           ;
  694.     sub     d2,res_pts     ;
  695. ;*******************************
  696. CkSgn:
  697.     move.b    firstneg,d2
  698.     cmp.b    negative,d2
  699.     beq.s    EndOfDiv
  700.     move.b    #1,res_sign
  701. EndOfDiv:
  702.     rts
  703.  
  704. ;************************************************************************
  705. ;  SUBROUTINE TO FIND OUT WHAT THE HELL SIGN TO USE ON ADD AND SUBTRACT
  706. ;        uses a0,a1 makes use of d0 from 'biggest'
  707. ;************************************************************************
  708. ;   oper    first   second  do        result
  709. ;-----------------------------------------
  710. ;   +        +        +        add     +
  711. ;   -        +        -        add     +
  712. ;   +        -        -        add     -
  713. ;   -        -        +        add     -
  714. ;   +        +        -        sub     biggest
  715. ;   +        -        +        sub     biggest
  716. ;   -        +        +        sub     if 1 big +    if 2 big -
  717. ;   -        -        -        sub     if 1 big -    if 2 big +
  718.  
  719. WhatTheHell:
  720.     bsr     align            ;first, align points.
  721.     cmp.b    #43,fun         ;plus
  722.     bne.s    on
  723. op:
  724.     tst.b    firstneg
  725.     beq.s    op1p
  726. op1n:
  727.     tst.b    negative
  728.     beq     op1n2p
  729. op1n2n:                 ;always minus
  730.     move.b    #1,res_sign
  731.     bsr     addemup
  732.     rts
  733. on:
  734.    tst.b    firstneg
  735.    beq        on1p
  736. on1n:
  737.     tst.b    negative
  738.     beq     on1n2p
  739. on1n2n:                 ;if 1 big then -
  740.     bsr     biggest
  741.     cmp.b    #1,d0
  742.     bne     it_is_a_plus
  743.     move.b    #1,res_sign
  744.     lea     accum1,a1
  745.     lea     accum2,a2
  746.     bsr     exchange
  747. it_is_a_plus:
  748.     bsr     subem
  749.     rts
  750. op1p:
  751.     tst.b    negative
  752.     beq     op1p2p
  753. op1p2n:                 ;sign of the biggest
  754.     bsr     biggest
  755.     cmp.b    #2,d0
  756.     beq     cecond_sgn
  757. fust_sgn:
  758.     lea     accum1,a1
  759.     lea     accum2,a2
  760.     bsr     exchange
  761.     move.b    firstneg,res_sign
  762.     bsr     subem
  763.     rts
  764. cecond_sgn
  765.     move.b    negative,res_sign
  766.     bsr     subem
  767.     rts
  768. on1p
  769.     tst.b    negative
  770.     beq.s    on1p2p
  771. on1p2n:                 ;always plus
  772.     bsr     addemup
  773.     rts
  774. on1p2p:                 ;if 2 big then -  dont exg
  775.     bsr     biggest
  776.     cmp.b    #2,d0
  777.     bne.s    two_small
  778.     move.b    #1,res_sign
  779.     bra.s    two_big
  780. two_small:
  781.     lea     accum1,a1
  782.     lea     accum2,a2
  783.     bsr     exchange
  784. two_big:
  785.     bsr     subem
  786.     rts
  787. on1n2p:                 ;always minus
  788.     move.b    #1,res_sign
  789.     bsr     addemup
  790.     rts
  791. op1p2p:                 ;always plus
  792.     bsr     addemup
  793.     rts
  794. op1n2p:                 ;sign of the biggest
  795.     bsr     biggest
  796.     cmp.b    #2,d0
  797.     beq     snd_sgn
  798. fst_sgn:
  799.     lea     accum1,a1
  800.     lea     accum2,a2
  801.     bsr     exchange
  802.     move.b    firstneg,res_sign
  803.     bsr     subem
  804.     rts
  805. snd_sgn
  806.     move.b    negative,res_sign
  807.     bsr     subem
  808.     rts
  809.  
  810. ;************************************************************************
  811. ;         SUBROUTINE TO PACK STRING INTO BCD FORM
  812. ; uses a3,a4,    d0,d1,d2  input accum accumX+63 in a4  outputs to accum.
  813. ; calls shift_l which uses a5,d4,d5,d6
  814. ;************************************************************************
  815.  
  816. pack:
  817.     lea     buildstr,a3
  818.     moveq    #$30,d1
  819.     moveq    #0,d2
  820.     swap    d2            ;Try to use swapping instruction.
  821.     moveq    #61,d2            ;just for fun
  822. eatzeros:
  823.     subq.b    #1,d2
  824.     bne.s    continue
  825.     swap    d2
  826.     move    d2,dec            ;count of dec points from rh side.
  827.     rts
  828. continue:
  829.     move.b    (a3)+,d0
  830.     tst.b    d0
  831.     beq     eatzeros
  832.     cmp.b    #',',d0
  833.     beq     eatzeros
  834.     cmp.b    #'+',d0
  835.     beq     eatzeros
  836.     cmp.b    #'-',d0
  837.     beq     eatzeros
  838.     cmp.b    #'.',d0
  839.     beq.s    decimal
  840.  
  841.     bsr     shift_l
  842.     tst.b    havept
  843.     beq.s    no_pt
  844.     swap    d2
  845.     addq    #1,d2
  846.     swap    d2
  847. no_pt:
  848.     sub.b    d1,d0
  849.     and.b    #$f,d0
  850.     or.b    d0,(a4)
  851.     bra     eatzeros
  852. decimal:
  853.     move.b    #1,havept
  854.     bra     eatzeros
  855.  
  856. ;************************************************************************
  857. ;         SUBROUTINE TO REMOVE TRAILING ZEROS FROM RESULT
  858. ;          uses d0,d1,d2  a4,a0   input accum address in a4
  859. ;************************************************************************
  860.  
  861. trail:
  862.     lea     accum2,a4        ;for sub shift_r
  863.  
  864.     movea.l    a4,a0
  865.     adda.l    #63,a0
  866.     move    #127,d1
  867. T1:
  868.     tst     res_pts         ;if we don't have a point we can't
  869.     beq.s    out            ;remove zeros
  870.     move.b    (a0),d0
  871.     andi.b    #$f,d0
  872.     bne.s    out
  873.     sub     #1,res_pts        ;decrease point count
  874.     bsr     shift_r
  875.     dbra    d1,T1
  876. out:
  877.     rts
  878.  
  879. ;************************************************************************
  880. ; SUBROUTINE TO UNPACK BCD BACK TO ASCII STRING WITH COMMAS AND DEC POINT
  881. ;     uses d0,d1,d2,d3,d7  a1,a2    didn't do commas yet
  882. ;************************************************************************
  883.  
  884. unpack:
  885.     move    #0,d7
  886.     bsr     trail
  887.     lea     accum2,a1
  888.     lea     buildstr,a2
  889.     moveq    #64,d0
  890. U2:
  891.     tst.b    (a1)+
  892.     dbne    d0,U2            ;dbcc checks cc before dec-ing.
  893.     cmp     #-1,d0
  894.     bne.s    notazero
  895.     move    #1,chars        ;if d0 counts down to -1, put 1 in
  896.     move.b    #$30,(a2)               ;chars and '0' in buildstr
  897.     rts
  898. notazero:
  899.     lsl     #1,d0
  900.     subq    #1,a1
  901.     cmp.b    #9,(a1)
  902.     bhi.s    U3
  903.     subq    #1,d0
  904. U3:
  905.     move    d0,chars        ;all that for no. of places in d0
  906.     move    res_pts,d1        ;also a1 is pointing to high byte
  907.                     ;points in result from right
  908.     move.b    res_sign,d2
  909.     beq.s    U5
  910.     moveq    #45,d2
  911.     move.b    d2,(a2)+
  912. U5:
  913.     cmp     d1,d0            ;d1 has res_pts  d0 has chars
  914.     bhi.s    no_first_pt        ;leave bhi it is correct
  915.     bsr     insert_point
  916.     cmp     d1,d0
  917.     beq.s    no_first_pt
  918. U6:
  919.     move.b    #$30,(a2)+
  920.     add     #1,chars        ;need to increase chars printed
  921.     cmp     #$78,chars
  922.     bcs.s    dontmess
  923.     sub     #1,chars
  924.     subq    #1,d1
  925.     subq    #1,d0
  926. dontmess:
  927.     cmp     chars,d1
  928.     bhi     U6
  929. no_first_pt
  930.     move    chars,d3
  931.     sub     d1,d3            ;difference bet res_pts & chars if
  932.                     ;chars is larger or equal
  933.     btst    #0,d0            ;odd or even no of bytes?
  934.     bne     odd
  935. even:
  936.     move.b    (a1),d2
  937.     lsr.b    #4,d2
  938.     andi.b    #$f,d2
  939.     add.b    #$30,d2
  940.     move.b    d2,(a2)+
  941.     subq    #1,d0
  942.     beq.s    U4
  943.     subq    #1,d3
  944.     bne.s    odd
  945.     bsr     insert_point
  946. odd:
  947.     move.b    (a1)+,d2                 ;pick up byte
  948.     andi.b    #$f,d2
  949.     add.b    #$30,d2
  950.     move.b    d2,(a2)+
  951.     subq    #1,d0
  952.     beq.s    U4
  953.     subq    #1,d3
  954.     bne     even
  955.     bsr     insert_point
  956.     bra     even
  957. U4:
  958.     add     d7,chars
  959.     rts
  960. insert_point:
  961.     move    #1,d7
  962.     move.b    #46,(a2)+
  963.     rts
  964.  
  965. ;************************************************************************
  966. ;              SUBROUTINE TO FIND THE BIGGEST
  967. ;  uses a3,a5, d0, no inputs.  output 1 if 1 larger. 2 if 2 -1 neither
  968. ;************************************************************************
  969.  
  970. biggest:
  971.     lea     accum1,a3
  972.     lea     accum2,a5
  973.     moveq    #63,d0
  974. repeat:
  975.     cmp.b    (a3)+,(a5)+
  976.     bhi.s    second
  977.     bcs.s    first
  978.     dbne    d0,repeat
  979.     rts
  980. first:
  981.     moveq    #1,d0
  982.     rts
  983. second:
  984.     moveq    #2,d0
  985.     rts
  986.  
  987. ;************************************************************************
  988. ;          SUBROUTINE SHIFT AN ACCUMULATOR LEFT FOUR BITS
  989. ;  uses a4,a5,    d4,d5,d6   input a4 with accum address+63  no outputs.
  990. ;************************************************************************
  991.  
  992. shift_l:
  993.     moveq    #3,d5
  994. SL1:
  995.     movea.l    a4,a5            ;a4 already has accum(1 or 2) addr+63
  996.     subq.l    #3,a5            ;Need accum+60 in a5
  997.     move.l    (a5),d6
  998.     asl.l    #1,d6
  999.     move.l    d6,(a5)
  1000.     moveq    #14,d4
  1001. SL2:
  1002.     move.l    -(a5),d6
  1003.     roxl.l    #1,d6
  1004.     move.l    d6,(a5)
  1005.     dbra    d4,SL2
  1006.     dbra    d5,SL1
  1007.     rts
  1008.  
  1009. ;************************************************************************
  1010. ;          SUBROUTINE SHIFT AN ACCUMULATOR RIGHT FOUR BITS
  1011. ;  uses a4,a5,    d4,d5,d6   input a4 with accum address+00  no outputs.
  1012. ;************************************************************************
  1013.  
  1014. shift_r:
  1015.     moveq    #3,d5
  1016. SHR1:
  1017.     movea.l    a4,a5
  1018.     move.l    (a5),d6
  1019.     lsr.l    #1,d6
  1020.     move.l    d6,(a5)+
  1021.     moveq    #14,d4
  1022. SHR2:
  1023.     move.l    (a5),d6
  1024.     roxr.l    #1,d6
  1025.     move.l    d6,(a5)+
  1026.     dbra    d4,SHR2
  1027.     dbra    d5,SHR1
  1028.     rts
  1029.  
  1030. ;************************************************************************
  1031. ;          SUBROUTINE EXCHANGE TWO ACCUMULATORS
  1032. ;               uses a1,a2,     d0,d1
  1033. ;************************************************************************
  1034.  
  1035. exchange:
  1036.     moveq.b    #15,d0
  1037. E1:
  1038.     move.l    (a1),d1
  1039.     move.l    (a2),(a1)+
  1040.     move.l    d1,(a2)+
  1041.     dbra    d0,E1
  1042.     rts
  1043.  
  1044. ;************************************************************************
  1045. ;           SUBROUTINE TO PRINT THE BUILDSTRING ARRAY (or anything)
  1046. ; uses a1,a0,a5,a6, d0,d1,d2,d3  input addr in a0  # of chars in chars
  1047. ;************************************************************************
  1048.  
  1049. print_bs:                ;prints the first 60 characters on
  1050.     moveq    #0,d2            ;one line and the next 60 on the
  1051.     move    chars,d3        ;next line.
  1052.     add.b    havept,d3
  1053.     add.b    res_sign,d3
  1054.     cmp     #61,d3
  1055.     bcs.s    smaller
  1056.     move    d3,d2
  1057.     subi    #60,d2
  1058.     move    #60,d3
  1059. smaller:
  1060.     movea.l    rp,a1
  1061.     moveq    #5,d0
  1062.     move    printy,d1
  1063.     movea.l    GBase,a6
  1064.     jsr     _LVOMove(a6)
  1065.     move    d3,d0
  1066.     jsr     _LVOText(a6)
  1067.     tst     d2
  1068.     beq     gohome
  1069.  
  1070.     movea.l    rp,a1
  1071.     moveq    #5,d0
  1072.     addi    #9,printy
  1073.     move    printy,d1
  1074.     jsr     _LVOMove(a6)
  1075.     lea     buildstr+60,a0
  1076.     move    d2,d0
  1077.     cmp     #60,d0
  1078.     bcs.s    sixty
  1079.     move    #60,d0
  1080. sixty:
  1081.     jsr     _LVOText(a6)
  1082. gohome:
  1083.     rts
  1084.  
  1085. ;~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  1086. ;~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  1087. ;~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  1088.     DATA   DATA
  1089.  
  1090. GName:
  1091.     dc.b    'graphics.library',0
  1092. IntuitionName:
  1093.     dc.b    'intuition.library',0
  1094. title:
  1095.     dc.b    'THE NATIONAL DEBT   A 120 place calculator by Martin Gitelson.',0
  1096. text1:
  1097.     dc.b    '1',0
  1098. text2:
  1099.     dc.b    '2',0
  1100. text3:
  1101.     dc.b    '3',0
  1102. text4:
  1103.     dc.b    '4',0
  1104. text5:
  1105.     dc.b    '5',0
  1106. text6:
  1107.     dc.b    '6',0
  1108. text7:
  1109.     dc.b    '7',0
  1110. text8:
  1111.     dc.b    '8',0
  1112. text9:
  1113.     dc.b    '9',0
  1114. text10:
  1115.     dc.b    '0',0
  1116. text11:
  1117.     dc.b    '.',0
  1118. text12:
  1119.     dc.b    ",",0
  1120. text13:
  1121.     dc.b    'C',0
  1122. text14:
  1123.     dc.b    'AC',0
  1124. text15:
  1125.     dc.b    '*',0
  1126. text16:
  1127.     dc.b    '/',0
  1128. text17:
  1129.     dc.b    '+',0
  1130. text18:
  1131.     dc.b    '-',0
  1132. text19:
  1133.     dc.b    '<',0
  1134. text20:
  1135.     dc.b    '=',0
  1136.  
  1137. IDCMPFlags   EQU   CLOSEWINDOW|GADGETUP
  1138. OtherFlags   EQU   WINDOWCLOSE|SMART_REFRESH|ACTIVATE|WINDOWDRAG|WINDOWDEPTH
  1139.  
  1140. blanks:
  1141.     dc.b    '                                                            ',0
  1142. errstr:
  1143.     dc.b    'ERROR',0
  1144.  
  1145.     EVEN
  1146.  
  1147. NewWdw:
  1148.     dc.w  0,50,640,74
  1149.     dc.b  2,1
  1150.     dc.l  IDCMPFlags
  1151.     dc.l  OtherFlags
  1152.     dc.l  Gad1        ;Firstgadget
  1153.     dc.l  0
  1154.     dc.l  title
  1155.     dc.l  0
  1156.     dc.l  0
  1157.     dc.w  640,73,640,73
  1158.     dc.w  WBENCHSCREEN
  1159. Gad1:
  1160.     dc.l    Gad2        ;struct Gadget *NextGadget
  1161.     dc.w    490         ;LeftEdge
  1162.     dc.w    12            ;TopEdge
  1163.     dc.w    26            ;Width
  1164.     dc.w    16            ;Height
  1165.     dc.w    GADGHCOMP        ;Flags
  1166.     dc.w    RELVERIFY        ;Activation
  1167.     dc.w    BOOLGADGET        ;GadgetType
  1168.     dc.l    Border1        ;APTR GadgetRender
  1169.     dc.l    0            ;APTR SelectRender
  1170.     dc.l    Textstruct1     ;struct IntuiText *GadgetText
  1171.     dc.l    0            ;LONG MutualExclude
  1172.     dc.l    0            ;APTR SpecialInfo
  1173.     dc.w    49            ;USHORT GadgetID
  1174.     dc.l    0            ;APTR UserData
  1175. Gad2:
  1176.     dc.l    Gad3
  1177.     dc.w    520,12,26,16,GADGHCOMP,RELVERIFY,BOOLGADGET
  1178.     dc.l    Border1,0,Textstruct2,0,0
  1179.     dc.w    50
  1180.     dc.l    0
  1181. Gad3:
  1182.     dc.l    Gad4
  1183.     dc.w    550,12,26,16,GADGHCOMP,RELVERIFY,BOOLGADGET
  1184.     dc.l    Border1,0,Textstruct3,0,0
  1185.     dc.w    51
  1186.     dc.l    0
  1187. Gad4:
  1188.     dc.l    Gad5
  1189.     dc.w    490,27,26,16,GADGHCOMP,RELVERIFY,BOOLGADGET
  1190.     dc.l    Border1,0,Textstruct4,0,0
  1191.     dc.w    52
  1192.     dc.l    0
  1193. Gad5:
  1194.     dc.l    Gad6
  1195.     dc.w    520,27,26,16,GADGHCOMP,RELVERIFY,BOOLGADGET
  1196.     dc.l    Border1,0,Textstruct5,0,0
  1197.     dc.w    53
  1198.     dc.l    0
  1199. Gad6:
  1200.     dc.l    Gad7
  1201.     dc.w    550,27,26,16,GADGHCOMP,RELVERIFY,BOOLGADGET
  1202.     dc.l    Border1,0,Textstruct6,0,0
  1203.     dc.w    54
  1204.     dc.l    0
  1205. Gad7:
  1206.     dc.l    Gad8
  1207.     dc.w    490,42,26,16,GADGHCOMP,RELVERIFY,BOOLGADGET
  1208.     dc.l    Border1,0,Textstruct7,0,0
  1209.     dc.w    55
  1210.     dc.l    0
  1211. Gad8:
  1212.     dc.l    Gad9
  1213.     dc.w    520,42,26,16,GADGHCOMP,RELVERIFY,BOOLGADGET
  1214.     dc.l    Border1,0,Textstruct8,0,0
  1215.     dc.w    56
  1216.     dc.l    0
  1217. Gad9:
  1218.     dc.l    Gad10
  1219.     dc.w    550,42,26,16,GADGHCOMP,RELVERIFY,BOOLGADGET
  1220.     dc.l    Border1,0,Textstruct9,0,0
  1221.     dc.w    57
  1222.     dc.l    0
  1223. Gad10:
  1224.     dc.l    Gad11
  1225.     dc.w    490,57,26,16,GADGHCOMP,RELVERIFY,BOOLGADGET
  1226.     dc.l    Border1,0,Textstruct10,0,0
  1227.     dc.w    48
  1228.     dc.l    0
  1229. Gad11:
  1230.     dc.l    Gad12
  1231.     dc.w    520,57,26,16,GADGHCOMP,RELVERIFY,BOOLGADGET
  1232.     dc.l    Border1,0,Textstruct11,0,0
  1233.     dc.w    46
  1234.     dc.l    0
  1235. Gad12:
  1236.     dc.l    Gad13
  1237.     dc.w    550,57,26,16,GADGHCOMP,RELVERIFY,BOOLGADGET
  1238.     dc.l    Border1,0,Textstruct12,0,0
  1239.     dc.w    44
  1240.     dc.l    0
  1241. Gad13:
  1242.     dc.l    Gad14
  1243.     dc.w    580,12,26,16,GADGHCOMP,RELVERIFY,BOOLGADGET
  1244.     dc.l    Border1,0,Textstruct13,0,0
  1245.     dc.w    13
  1246.     dc.l    0
  1247. Gad14:
  1248.     dc.l    Gad15
  1249.     dc.w    610,12,26,16,GADGHCOMP,RELVERIFY,BOOLGADGET
  1250.     dc.l    Border1,0,Textstruct14,0,0
  1251.     dc.w    14
  1252.     dc.l    0
  1253. Gad15:
  1254.     dc.l    Gad16
  1255.     dc.w    580,27,26,16,GADGHCOMP,RELVERIFY,BOOLGADGET
  1256.     dc.l    Border1,0,Textstruct15,0,0
  1257.     dc.w    42
  1258.     dc.l    0
  1259. Gad16:
  1260.     dc.l    Gad17
  1261.     dc.w    610,27,26,16,GADGHCOMP,RELVERIFY,BOOLGADGET
  1262.     dc.l    Border1,0,Textstruct16,0,0
  1263.     dc.w    47
  1264.     dc.l    0
  1265. Gad17:
  1266.     dc.l    Gad18
  1267.     dc.w    580,42,26,16,GADGHCOMP,RELVERIFY,BOOLGADGET
  1268.     dc.l    Border1,0,Textstruct17,0,0
  1269.     dc.w    43
  1270.     dc.l    0
  1271. Gad18:
  1272.     dc.l    Gad19
  1273.     dc.w    610,42,26,16,GADGHCOMP,RELVERIFY,BOOLGADGET
  1274.     dc.l    Border1,0,Textstruct18,0,0
  1275.     dc.w    45
  1276.     dc.l    0
  1277. Gad19:
  1278.     dc.l    Gad20
  1279.     dc.w    580,57,26,16,GADGHCOMP,RELVERIFY,BOOLGADGET
  1280.     dc.l    Border1,0,Textstruct19,0,0
  1281.     dc.w    19
  1282.     dc.l    0
  1283. Gad20:
  1284.     dc.l    0
  1285.     dc.w    610,57,26,16,GADGHCOMP,RELVERIFY,BOOLGADGET
  1286.     dc.l    Border1,0,Textstruct20,0,0
  1287.     dc.w    61
  1288.     dc.l    0
  1289. Textstruct1:          ;size=20
  1290.     dc.b    2,1
  1291.     dc.w    0,10,5
  1292.     dc.l    0,text1,0
  1293. Textstruct2:
  1294.     dc.b    2,1
  1295.     dc.w    0,10,5
  1296.     dc.l    0,text2,0
  1297. Textstruct3:
  1298.     dc.b    2,1
  1299.     dc.w    0,10,5
  1300.     dc.l    0,text3,0
  1301. Textstruct4:
  1302.     dc.b    2,1
  1303.     dc.w    0,10,5
  1304.     dc.l    0,text4,0
  1305. Textstruct5:
  1306.     dc.b    2,1
  1307.     dc.w    0,10,5
  1308.     dc.l    0,text5,0
  1309. Textstruct6:
  1310.     dc.b    2,1
  1311.     dc.w    0,10,5
  1312.     dc.l    0,text6,0
  1313. Textstruct7:
  1314.     dc.b    2,1
  1315.     dc.w    0,10,5
  1316.     dc.l    0,text7,0
  1317. Textstruct8:
  1318.     dc.b    2,1
  1319.     dc.w    0,10,5
  1320.     dc.l    0,text8,0
  1321. Textstruct9:
  1322.     dc.b    2,1
  1323.     dc.w    0,10,5
  1324.     dc.l    0,text9,0
  1325. Textstruct10:
  1326.     dc.b    2,1
  1327.     dc.w    0,10,5
  1328.     dc.l    0,text10,0
  1329. Textstruct11:
  1330.     dc.b    2,1
  1331.     dc.w    0,10,5
  1332.     dc.l    0,text11,0
  1333. Textstruct12:
  1334.     dc.b    2,1
  1335.     dc.w    0,10,5
  1336.     dc.l    0,text12,0
  1337. Textstruct13:
  1338.     dc.b    3,1
  1339.     dc.w    0,10,5
  1340.     dc.l    0,text13,0
  1341. Textstruct14:
  1342.     dc.b    3,1
  1343.     dc.w    0,6,5
  1344.     dc.l    0,text14,0
  1345. Textstruct15:
  1346.     dc.b    1,1
  1347.     dc.w    0,10,5
  1348.     dc.l    0,text15,0
  1349. Textstruct16:
  1350.     dc.b    1,1
  1351.     dc.w    0,10,5
  1352.     dc.l    0,text16,0
  1353. Textstruct17:
  1354.     dc.b    1,1
  1355.     dc.w    0,10,5
  1356.     dc.l    0,text17,0
  1357. Textstruct18:
  1358.     dc.b    1,1
  1359.     dc.w    0,10,5
  1360.     dc.l    0,text18,0
  1361. Textstruct19:
  1362.     dc.b    2,1
  1363.     dc.w    0,10,5
  1364.     dc.l    0,text19,0
  1365. Textstruct20:
  1366.     dc.b    1,1
  1367.     dc.w    0,10,5
  1368.     dc.l    0,text20,0
  1369. Border1:
  1370.     dc.w    0          ;   0  LeftEdge
  1371.     dc.w    0          ;   2  TopEdge
  1372.     dc.b    1          ;   4  FrontPen
  1373.     dc.b    2          ;   5  BackPen
  1374.     dc.b    0          ;   6  DrawMode
  1375.     dc.b    6          ;   7  Count
  1376.     dc.l    Vectors1  ;   8  XY
  1377.     dc.l    Border2   ;  12  NextBorder
  1378. Border2:
  1379.     dc.w    0,0
  1380.     dc.b    2,3,0,6
  1381.     dc.l    Vectors2,0
  1382. Vectors1:
  1383.     dc.w    0,15,0,0,25,0,25,1,1,1,1,14
  1384. Vectors2:
  1385.     dc.w    25,0,25,15,0,15,1,14,24,14,24,1
  1386.  
  1387.     BSS   BSS
  1388.  
  1389.     EVEN
  1390. parksp
  1391.     ds.l  1
  1392. IntBase:
  1393.     ds.l  1
  1394. GBase:
  1395.     ds.l  1
  1396. Wdw:
  1397.     ds.l  1
  1398. userport:
  1399.     ds.l  1
  1400. WBenchMsg:
  1401.     ds.l  1
  1402. class
  1403.     ds.l  1
  1404. rp:
  1405.     ds.l  1
  1406. sigmask:
  1407.     ds.l  1
  1408. buildstr:
  1409.     ds.b  128
  1410. accum1:
  1411.     ds.b  64
  1412. accum2:
  1413.     ds.b  64
  1414. accum3:
  1415.     ds.b  64
  1416. printy:
  1417.     ds.w  1            ;20 bytes follow to be cleared
  1418. dec:
  1419.     ds.w  1
  1420. firstdec:
  1421.     ds.w  1
  1422. res_pts:
  1423.     ds.w  1
  1424. chars:
  1425.     ds.w  1
  1426. div1:
  1427.     ds.b  1
  1428. div2:
  1429.     ds.b  1
  1430. point:
  1431.     ds.b  1
  1432. havept:
  1433.     ds.b  1
  1434. negative:
  1435.     ds.b  1
  1436. firstneg:
  1437.     ds.b  1
  1438. res_sign:
  1439.     ds.b  1
  1440. fun:
  1441.     ds.b  1
  1442. eq:                    ;park equals sign here for printing
  1443.     ds.b  1
  1444. fun2:
  1445.     ds.b  1
  1446. pad:
  1447.     ds.b  6                ;so clear won't affect something else
  1448.     END
  1449.  
  1450.